<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Math module | Butano Docs</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
  <link rel="icon" href="favicon-dark.png" type="image/png" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="theme-color" content="#22272e" />
</head>
<body>
<header><nav id="navigation">
  <div class="m-container">
    <div class="m-row">
      <span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
        <a href="https://github.com/GValiente/butano">Butano</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">Docs</a>
      </span>
      <div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
        <a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
          <path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
        </svg></a>
        <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
        <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
      </div>
      <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
        <div class="m-row">
          <ol class="m-col-t-6 m-col-m-none">
            <li><a href="pages.html">Pages</a></li>
            <li><a href="modules.html">Modules</a></li>
          </ol>
          <ol class="m-col-t-6 m-col-m-none" start="3">
            <li><a href="namespaces.html">Namespaces</a></li>
            <li><a href="annotated.html">Classes</a></li>
            <li><a href="files.html">Files</a></li>
            <li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
              <use href="#m-doc-search-icon-path" />
            </svg></a></li>
          </ol>
        </div>
      </div>
    </div>
  </div>
</nav></header>
<main><article>
  <div class="m-container m-container-inflatable">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <h1>
          Math <span class="m-thin">module</span></h1>
        <nav class="m-block m-default">
          <h3>Contents</h3>
          <ul>
            <li>
              Reference
              <ul>
                <li><a href="#files">Files</a></li>
                <li><a href="#nested-classes">Classes</a></li>
                <li><a href="#func-members">Functions</a></li>
                <li><a href="#var-members">Variables</a></li>
              </ul>
            </li>
          </ul>
        </nav>
<p>Math related stuff.</p>
        <section id="files">
          <h2><a href="#files">Files</a></h2>
          <dl class="m-doc">
            <dt>file <a href="bn__fixed_8h.html" class="m-doc">bn_fixed.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__fwd_8h.html" class="m-doc">bn_fixed_fwd.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__point_8h.html" class="m-doc">bn_fixed_point.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__point__fwd_8h.html" class="m-doc">bn_fixed_point_fwd.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__rect_8h.html" class="m-doc">bn_fixed_rect.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__rect__fwd_8h.html" class="m-doc">bn_fixed_rect_fwd.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__size_8h.html" class="m-doc">bn_fixed_size.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__fixed__size__fwd_8h.html" class="m-doc">bn_fixed_size_fwd.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__math_8h.html" class="m-doc">bn_math.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__point_8h.html" class="m-doc">bn_point.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__power__of__two_8h.html" class="m-doc">bn_power_of_two.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__reciprocal__lut_8h.html" class="m-doc">bn_reciprocal_lut.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__rect_8h.html" class="m-doc">bn_rect.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__rule__of__three__approximation_8h.html" class="m-doc">bn_rule_of_three_approximation.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__sin__lut_8h.html" class="m-doc">bn_sin_lut.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__size_8h.html" class="m-doc">bn_size.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__top__left__fixed__rect_8h.html" class="m-doc">bn_top_left_fixed_rect.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__top__left__fixed__rect__fwd_8h.html" class="m-doc">bn_top_left_fixed_rect_fwd.h</a></dt>
            <dd></dd>
            <dt>file <a href="bn__top__left__rect_8h.html" class="m-doc">bn_top_left_rect.h</a></dt>
            <dd></dd>
          </dl>
        </section>
        <section id="nested-classes">
          <h2><a href="#nested-classes">Classes</a></h2>
          <dl class="m-doc">
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              struct <a href="structbn_1_1hash_3_01fixed__t_3_01_precision_01_4_01_4.html" class="m-doc">bn::hash&lt;fixed_t&lt;Precision&gt;&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1fixed__t.html" class="m-doc">fixed_<wbr />t</a>.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              class <a href="classbn_1_1fixed__t.html" class="m-doc">bn::fixed_t</a>
            </dt>
            <dd>Poor man&#x27;s float.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              struct <a href="structbn_1_1hash_3_01fixed__point__t_3_01_precision_01_4_01_4.html" class="m-doc">bn::hash&lt;fixed_point_t&lt;Precision&gt;&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1fixed__point__t.html" class="m-doc">fixed_<wbr />point_<wbr />t</a>.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              class <a href="classbn_1_1fixed__point__t.html" class="m-doc">bn::fixed_point_t</a>
            </dt>
            <dd>Defines a two-dimensional point using fixed point precision.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              struct <a href="structbn_1_1hash_3_01fixed__rect__t_3_01_precision_01_4_01_4.html" class="m-doc">bn::hash&lt;fixed_rect_t&lt;Precision&gt;&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1fixed__rect__t.html" class="m-doc">fixed_<wbr />rect_<wbr />t</a>.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              class <a href="classbn_1_1fixed__rect__t.html" class="m-doc">bn::fixed_rect_t</a>
            </dt>
            <dd>Defines a two-dimensional rectangle using fixed point precision and a center point as position.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              struct <a href="structbn_1_1hash_3_01fixed__size__t_3_01_precision_01_4_01_4.html" class="m-doc">bn::hash&lt;fixed_size_t&lt;Precision&gt;&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1fixed__size__t.html" class="m-doc">fixed_<wbr />size_<wbr />t</a>.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              class <a href="classbn_1_1fixed__size__t.html" class="m-doc">bn::fixed_size_t</a>
            </dt>
            <dd>Defines the size of a two-dimensional object using fixed point precision.</dd>
            <dt>
              class <a href="classbn_1_1point.html" class="m-doc">bn::point</a>
            </dt>
            <dd>Defines a two-dimensional point using integer precision.</dd>
            <dt>
              <div class="m-doc-template">template&lt;&gt;</div>
              struct <a href="structbn_1_1hash_3_01point_01_4.html" class="m-doc">bn::hash&lt;point&gt;</a>
            </dt>
            <dd>Hash support for point.</dd>
            <dt>
              class <a href="classbn_1_1rect.html" class="m-doc">bn::rect</a>
            </dt>
            <dd>Defines a two-dimensional rectangle using integer precision and a center point as position.</dd>
            <dt>
              <div class="m-doc-template">template&lt;&gt;</div>
              struct <a href="structbn_1_1hash_3_01rect_01_4.html" class="m-doc">bn::hash&lt;rect&gt;</a>
            </dt>
            <dd>Hash support for rect.</dd>
            <dt>
              class <a href="classbn_1_1rule__of__three__approximation.html" class="m-doc">bn::rule_of_three_approximation</a>
            </dt>
            <dd>Approximates a rule of three cross-multiplication (x = (value * multiplier) / divisor).</dd>
            <dt>
              class <a href="classbn_1_1size.html" class="m-doc">bn::size</a>
            </dt>
            <dd>Defines the size of a two-dimensional object using integer precision.</dd>
            <dt>
              <div class="m-doc-template">template&lt;&gt;</div>
              struct <a href="structbn_1_1hash_3_01size_01_4.html" class="m-doc">bn::hash&lt;size&gt;</a>
            </dt>
            <dd>Hash support for size.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              struct <a href="structbn_1_1hash_3_01top__left__fixed__rect__t_3_01_precision_01_4_01_4.html" class="m-doc">bn::hash&lt;top_left_fixed_rect_t&lt;Precision&gt;&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1top__left__fixed__rect__t.html" class="m-doc">top_<wbr />left_<wbr />fixed_<wbr />rect_<wbr />t</a>.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              class <a href="classbn_1_1top__left__fixed__rect__t.html" class="m-doc">bn::top_left_fixed_rect_t</a>
            </dt>
            <dd>Defines a two-dimensional rectangle using fixed point precision and a top-left point as position.</dd>
            <dt>
              class <a href="classbn_1_1top__left__rect.html" class="m-doc">bn::top_left_rect</a>
            </dt>
            <dd>Defines a two-dimensional rectangle using integer precision and a top-left point as position.</dd>
            <dt>
              <div class="m-doc-template">template&lt;&gt;</div>
              struct <a href="structbn_1_1hash_3_01top__left__rect_01_4.html" class="m-doc">bn::hash&lt;top_left_rect&gt;</a>
            </dt>
            <dd>Hash support for <a href="classbn_1_1top__left__rect.html" class="m-doc">top_<wbr />left_<wbr />rect</a>.</dd>
          </dl>
        </section>
        <section id="func-members">
          <h2><a href="#func-members">Functions</a></h2>
          <dl class="m-doc">
            <dt>
              <div class="m-doc-template">template&lt;typename Type&gt;</div>
              <span class="m-doc-wrap-bumper">auto <a href="#ga838914e9d067e7621300539acc2e291f" class="m-doc">abs</a>(</span><span class="m-doc-wrap">Type value) -&gt; Type <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Returns the absolute value of the given value.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gaf87b16f04d5c22fcb6dac8cdc42cdc17" class="m-doc">sqrt</a>(</span><span class="m-doc-wrap">int value) -&gt; <a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr int <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Returns the integer square root of the given value.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              <span class="m-doc-wrap-bumper">auto <a href="#ga982d6c9b1bc00c0f562d1c6508c30aea" class="m-doc">sqrt</a>(</span><span class="m-doc-wrap">fixed_t&lt;Precision&gt; value) -&gt; <a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr fixed_t&lt;(Precision+1)/2&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Returns the fixed point square root of the given value.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision&gt;</div>
              <span class="m-doc-wrap-bumper">auto <a href="#ga150d06193cada537b2978edd85fd25c6" class="m-doc">unsafe_sqrt</a>(</span><span class="m-doc-wrap">fixed_t&lt;Precision&gt; value) -&gt; <a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr fixed_t&lt;Precision&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Returns the fixed point square root of the given value without trying to avoid overflow.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga3f84312f5751bc707185733a2726ed2a" class="m-doc">safe_degrees_angle</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Returns an angle in degrees in the range [0..360) from the given angle in degrees in any range.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga589ed853116ac004d9ecc481fc283438" class="m-doc">sin</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine value of an angle.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga8f5501ff7b8ffc25e2a692796dea56b9" class="m-doc">degrees_sin</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine value of an angle in degrees.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gaa68f202b3c36d0b0b208d6993fcc14be" class="m-doc">lut_sin</a>(</span><span class="m-doc-wrap">int lut_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine value of an angle using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga5efbddb9091a5e4cff2d8ac4c97992f4" class="m-doc">degrees_lut_sin</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine value of an angle in degrees using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga93b9aa2a691c91b85e6b2434fbd0c389" class="m-doc">degrees_lut_sin_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine value of an angle in degrees in any range using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gacb83d14734a56f9da47034ce80459b34" class="m-doc">cos</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the cosine value of an angle.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga6033befc7142055cf5249bc446ea0f2f" class="m-doc">degrees_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the cosine value of an angle in degrees.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga98f2967b1d885540c4cd2a141a8bd6e2" class="m-doc">lut_cos</a>(</span><span class="m-doc-wrap">int lut_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the cosine value of an angle using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga22a19da000f91da1b7ec4bd18e5206fb" class="m-doc">degrees_lut_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the cosine value of an angle in degrees using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga7b086f6f733857c2baae8b3ed45df802" class="m-doc">degrees_lut_cos_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the cosine value of an angle in degrees in any range using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga0632c9572fadf8f74a7df210f23646b5" class="m-doc">sin_and_cos</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) -&gt; pair&lt;fixed, fixed&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine and the cosine values of an angle.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gae8837970c7a3aea466c06b8077a5d17d" class="m-doc">degrees_sin_and_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; pair&lt;fixed, fixed&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine and the cosine values of an angle in degrees.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gadfad2d9ce4c72e19c7fb22c4dcf269a1" class="m-doc">lut_sin_and_cos</a>(</span><span class="m-doc-wrap">int lut_angle) -&gt; pair&lt;fixed, fixed&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine and the cosine values value of an angle using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga71e8b700ef0c4e7e8eb264d78defe65c" class="m-doc">degrees_lut_sin_and_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; pair&lt;fixed, fixed&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine and the cosine values of an angle in degrees using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga3a6996bf0ed5a86b07c2ebfe13b5d6f4" class="m-doc">degrees_lut_sin_and_cos_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) -&gt; pair&lt;fixed, fixed&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the sine and the cosine values of an angle in degrees in any range using a LUT.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga78f693fa4296294dd21c68557e916aa3" class="m-doc">atan2</a>(</span><span class="m-doc-wrap">int y,
              int x) -&gt; <a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> fixed_t&lt;16&gt;</span>
            </dt>
            <dd>Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga4f44ebe732a5726299387598c5cd1caa" class="m-doc">degrees_atan2</a>(</span><span class="m-doc-wrap">int y,
              int x) -&gt; <a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> fixed</span>
            </dt>
            <dd>Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga85e7e6e77aa0c5e2ac9ca9ca1147cb48" class="m-doc">diamond_angle</a>(</span><span class="m-doc-wrap">int y,
              int x) -&gt; fixed_t&lt;16&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Computes an approximation of the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gae58559f9c545a9787c41b2e59db8eac7" class="m-doc">degrees_diamond_angle</a>(</span><span class="m-doc-wrap">int y,
              int x) -&gt; fixed <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Computes an approximation of the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#gafc2a7463570f753f22185c1529bd9ee6" class="m-doc">lut_reciprocal</a>(</span><span class="m-doc-wrap">int lut_value) -&gt; fixed_t&lt;20&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the reciprocal of a value using a LUT.</dd>
            <dt>
              <div class="m-doc-template">template&lt;typename Type&gt;</div>
              <span class="m-doc-wrap-bumper">auto <a href="#ga312ac8ea549b0f7666489a2070c92985" class="m-doc">power_of_two</a>(</span><span class="m-doc-wrap">Type value) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Indicates if the given value is a power of two or not.</dd>
            <dt>
              <div class="m-doc-template">template&lt;int Precision = 20&gt;</div>
              <span class="m-doc-wrap-bumper">auto <a href="#ga439545803e369aae4f082185a303ad42" class="m-doc">calculate_reciprocal_lut_value</a>(</span><span class="m-doc-wrap">int lut_value) -&gt; fixed_t&lt;Precision&gt; <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the value to store in a reciprocal LUT for the given value.</dd>
            <dt>
              <span class="m-doc-wrap-bumper">auto <a href="#ga82b19260c9629813641b3b12d41f6c4c" class="m-doc">calculate_sin_lut_value</a>(</span><span class="m-doc-wrap">int lut_angle) -&gt; int <span class="m-label m-flat m-primary">constexpr</span></span>
            </dt>
            <dd>Calculates the value to store in sin_lut for the given angle.</dd>
          </dl>
        </section>
        <section id="var-members">
          <h2><a href="#var-members">Variables</a></h2>
          <dl class="m-doc">
            <dt>
              int <a href="#ga61bcfd89f00ba61921ec65d0d63d2929" class="m-doc">reciprocal_lut_size</a> <span class="m-label m-flat m-primary">constexpr</span>
            </dt>
            <dd>Reciprocal 20bit LUT size.</dd>
            <dt>
              const array&lt;fixed_t&lt;20&gt;, reciprocal_lut_size&gt;&amp; <a href="#ga21a22d7f03116a7613dd016d4dfdf37f" class="m-doc">reciprocal_lut</a>
            </dt>
            <dd>Reciprocal 20bit LUT.</dd>
            <dt>
              int <a href="#gaf652abc9f83efb92dfe600eb7a4f41f8" class="m-doc">reciprocal_16_lut_size</a> <span class="m-label m-flat m-primary">constexpr</span>
            </dt>
            <dd>Reciprocal 16bit LUT size.</dd>
            <dt>
              const array&lt;uint16_t, reciprocal_16_lut_size&gt;&amp; <a href="#ga04a69179088d3b9b510a9ca99770cc63" class="m-doc">reciprocal_16_lut</a>
            </dt>
            <dd>Reciprocal 16bit LUT.</dd>
            <dt>
              int <a href="#ga170826a79a9cb7f906d35193f51ec36a" class="m-doc">sin_lut_size</a> <span class="m-label m-flat m-primary">constexpr</span>
            </dt>
            <dd>Size of the sine LUT of 16bit values in 4.12 format.</dd>
            <dt>
              const array&lt;int16_t, sin_lut_size&gt;&amp; <a href="#gae40612108ff33cd48ca1b2c25dea2064" class="m-doc">sin_lut</a>
            </dt>
            <dd>Sine LUT of 16bit values in 4.12 format.</dd>
          </dl>
        </section>
        <section>
          <h2>Function documentation</h2>
          <section class="m-doc-details" id="ga838914e9d067e7621300539acc2e291f"><div>
            <h3>
              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
              <div class="m-doc-template">
                template&lt;typename Type&gt;
              </div>
              <span class="m-doc-wrap-bumper">Type </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga838914e9d067e7621300539acc2e291f" class="m-doc-self">abs</a>(</span><span class="m-doc-wrap">Type value) <span class="m-label m-primary">constexpr</span></span></span>
            </h3>
            <p>Returns the absolute value of the given value.</p>
          </div></section>
          <section class="m-doc-details" id="gaf87b16f04d5c22fcb6dac8cdc42cdc17"><div>
            <h3>
              <span class="m-doc-wrap-bumper"><a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr int </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gaf87b16f04d5c22fcb6dac8cdc42cdc17" class="m-doc-self">sqrt</a>(</span><span class="m-doc-wrap">int value) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Returns the integer square root of the given value.</p>
          </div></section>
          <section class="m-doc-details" id="ga982d6c9b1bc00c0f562d1c6508c30aea"><div>
            <h3>
              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
              <div class="m-doc-template">
                template&lt;int Precision&gt;
              </div>
              <span class="m-doc-wrap-bumper"><a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr fixed_t&lt;(Precision+1)/2&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga982d6c9b1bc00c0f562d1c6508c30aea" class="m-doc-self">sqrt</a>(</span><span class="m-doc-wrap">fixed_t&lt;Precision&gt; value) <span class="m-label m-primary">constexpr</span></span></span>
            </h3>
            <p>Returns the fixed point square root of the given value.</p>
<p>See <a href="https://github.com/JoaoBaptMG/gba-modern/blob/master/source/math/fixedmath.hpp">https:/<wbr />/<wbr />github.com/<wbr />JoaoBaptMG/<wbr />gba-modern/<wbr />blob/<wbr />master/<wbr />source/<wbr />math/<wbr />fixedmath.hpp</a></p>
          </div></section>
          <section class="m-doc-details" id="ga150d06193cada537b2978edd85fd25c6"><div>
            <h3>
              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
              <div class="m-doc-template">
                template&lt;int Precision&gt;
              </div>
              <span class="m-doc-wrap-bumper"><a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> constexpr fixed_t&lt;Precision&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga150d06193cada537b2978edd85fd25c6" class="m-doc-self">unsafe_sqrt</a>(</span><span class="m-doc-wrap">fixed_t&lt;Precision&gt; value) <span class="m-label m-primary">constexpr</span></span></span>
            </h3>
            <p>Returns the fixed point square root of the given value without trying to avoid overflow.</p>
<p>See <a href="https://github.com/JoaoBaptMG/gba-modern/blob/master/source/math/fixedmath.hpp">https:/<wbr />/<wbr />github.com/<wbr />JoaoBaptMG/<wbr />gba-modern/<wbr />blob/<wbr />master/<wbr />source/<wbr />math/<wbr />fixedmath.hpp</a></p>
          </div></section>
          <section class="m-doc-details" id="ga3f84312f5751bc707185733a2726ed2a"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga3f84312f5751bc707185733a2726ed2a" class="m-doc-self">safe_degrees_angle</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Returns an angle in degrees in the range [0..360) from the given angle in degrees in any range.</p>
          </div></section>
          <section class="m-doc-details" id="ga589ed853116ac004d9ecc481fc283438"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga589ed853116ac004d9ecc481fc283438" class="m-doc-self">sin</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine value of an angle.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">angle</td>
                  <td>Angle (2π = 1).</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga8f5501ff7b8ffc25e2a692796dea56b9"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga8f5501ff7b8ffc25e2a692796dea56b9" class="m-doc-self">degrees_sin</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine value of an angle in degrees.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="gaa68f202b3c36d0b0b208d6993fcc14be"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gaa68f202b3c36d0b0b208d6993fcc14be" class="m-doc-self">lut_sin</a>(</span><span class="m-doc-wrap">int lut_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine value of an angle using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">lut_angle</td>
                  <td>Angle in the range [0..2048].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga5efbddb9091a5e4cff2d8ac4c97992f4"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga5efbddb9091a5e4cff2d8ac4c97992f4" class="m-doc-self">degrees_lut_sin</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine value of an angle in degrees using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in the range [0..360].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga93b9aa2a691c91b85e6b2434fbd0c389"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga93b9aa2a691c91b85e6b2434fbd0c389" class="m-doc-self">degrees_lut_sin_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine value of an angle in degrees in any range using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in any range.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="gacb83d14734a56f9da47034ce80459b34"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gacb83d14734a56f9da47034ce80459b34" class="m-doc-self">cos</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the cosine value of an angle.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">angle</td>
                  <td>Angle (2π = 1).</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Cosine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga6033befc7142055cf5249bc446ea0f2f"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga6033befc7142055cf5249bc446ea0f2f" class="m-doc-self">degrees_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the cosine value of an angle in degrees.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Cosine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga98f2967b1d885540c4cd2a141a8bd6e2"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga98f2967b1d885540c4cd2a141a8bd6e2" class="m-doc-self">lut_cos</a>(</span><span class="m-doc-wrap">int lut_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the cosine value of an angle using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">lut_angle</td>
                  <td>Angle in the range [0..2048].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Cosine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga22a19da000f91da1b7ec4bd18e5206fb"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga22a19da000f91da1b7ec4bd18e5206fb" class="m-doc-self">degrees_lut_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the cosine value of an angle in degrees using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in the range [0..360].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Cosine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga7b086f6f733857c2baae8b3ed45df802"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga7b086f6f733857c2baae8b3ed45df802" class="m-doc-self">degrees_lut_cos_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the cosine value of an angle in degrees in any range using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in any range.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Cosine value in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga0632c9572fadf8f74a7df210f23646b5"><div>
            <h3>
              <span class="m-doc-wrap-bumper">pair&lt;fixed, fixed&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga0632c9572fadf8f74a7df210f23646b5" class="m-doc-self">sin_and_cos</a>(</span><span class="m-doc-wrap">fixed_t&lt;16&gt; angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine and the cosine values of an angle.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">angle</td>
                  <td>Angle (2π = 1).</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine and cosine values in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="gae8837970c7a3aea466c06b8077a5d17d"><div>
            <h3>
              <span class="m-doc-wrap-bumper">pair&lt;fixed, fixed&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gae8837970c7a3aea466c06b8077a5d17d" class="m-doc-self">degrees_sin_and_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine and the cosine values of an angle in degrees.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine and cosine values in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="gadfad2d9ce4c72e19c7fb22c4dcf269a1"><div>
            <h3>
              <span class="m-doc-wrap-bumper">pair&lt;fixed, fixed&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gadfad2d9ce4c72e19c7fb22c4dcf269a1" class="m-doc-self">lut_sin_and_cos</a>(</span><span class="m-doc-wrap">int lut_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine and the cosine values value of an angle using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">lut_angle</td>
                  <td>Angle in the range [0..2048].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine and cosine values in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga71e8b700ef0c4e7e8eb264d78defe65c"><div>
            <h3>
              <span class="m-doc-wrap-bumper">pair&lt;fixed, fixed&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga71e8b700ef0c4e7e8eb264d78defe65c" class="m-doc-self">degrees_lut_sin_and_cos</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine and the cosine values of an angle in degrees using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in the range [0..360].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine and cosine values in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga3a6996bf0ed5a86b07c2ebfe13b5d6f4"><div>
            <h3>
              <span class="m-doc-wrap-bumper">pair&lt;fixed, fixed&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga3a6996bf0ed5a86b07c2ebfe13b5d6f4" class="m-doc-self">degrees_lut_sin_and_cos_safe</a>(</span><span class="m-doc-wrap">fixed degrees_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the sine and the cosine values of an angle in degrees in any range using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">degrees_angle</td>
                  <td>Angle in degrees in any range.</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine and cosine values in the range [-1..1].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga78f693fa4296294dd21c68557e916aa3"><div>
            <h3>
              <span class="m-doc-wrap-bumper"><a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> fixed_t&lt;16&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga78f693fa4296294dd21c68557e916aa3" class="m-doc-self">atan2</a>(</span><span class="m-doc-wrap">int y,
              int x)</span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">y</td>
                  <td>Vertical value in the range [-32767..32767].</td>
                </tr>
                <tr>
                  <td>x</td>
                  <td>Horizontal value in the range [-32767..32767].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Arc tangent of y/x in the range [-0.5..0.5] (2π = 1).</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga4f44ebe732a5726299387598c5cd1caa"><div>
            <h3>
              <span class="m-doc-wrap-bumper"><a href="group__other.html#ga18012c35ef2ae80d6c102554e2150da3" class="m-doc">BN_<wbr />CONST</a> fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga4f44ebe732a5726299387598c5cd1caa" class="m-doc-self">degrees_atan2</a>(</span><span class="m-doc-wrap">int y,
              int x)</span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">y</td>
                  <td>Vertical value in the range [-32767..32767].</td>
                </tr>
                <tr>
                  <td>x</td>
                  <td>Horizontal value in the range [-32767..32767].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Arc tangent of y/x in degrees in the range [-180..180].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga85e7e6e77aa0c5e2ac9ca9ca1147cb48"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed_t&lt;16&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga85e7e6e77aa0c5e2ac9ca9ca1147cb48" class="m-doc-self">diamond_angle</a>(</span><span class="m-doc-wrap">int y,
              int x) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Computes an approximation of the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">y</td>
                  <td>Vertical value in the range [-131072..131071].</td>
                </tr>
                <tr>
                  <td>x</td>
                  <td>Horizontal value in the range [-131072..131071].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Arc tangent of y/x in the range [-0.5..0.5] (2π = 1).</td>
                </tr>
              </tfoot>
            </table>
<p><a href="https://www.freesteel.co.uk/wpblog/2009/06/05/encoding-2d-angles-without-trigonometry/">https:/<wbr />/<wbr />www.freesteel.co.uk/<wbr />wpblog/<wbr />2009/<wbr />06/<wbr />05/<wbr />encoding-2d-angles-without-trigonometry/<wbr /></a></p>
          </div></section>
          <section class="m-doc-details" id="gae58559f9c545a9787c41b2e59db8eac7"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gae58559f9c545a9787c41b2e59db8eac7" class="m-doc-self">degrees_diamond_angle</a>(</span><span class="m-doc-wrap">int y,
              int x) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Computes an approximation of the arc tangent of y/x using the signs of arguments to determine the correct quadrant.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">y</td>
                  <td>Vertical value in the range [-131072..131071].</td>
                </tr>
                <tr>
                  <td>x</td>
                  <td>Horizontal value in the range [-131072..131071].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Arc tangent of y/x in degrees in the range [-180..180].</td>
                </tr>
              </tfoot>
            </table>
<p><a href="https://www.freesteel.co.uk/wpblog/2009/06/05/encoding-2d-angles-without-trigonometry/">https:/<wbr />/<wbr />www.freesteel.co.uk/<wbr />wpblog/<wbr />2009/<wbr />06/<wbr />05/<wbr />encoding-2d-angles-without-trigonometry/<wbr /></a></p>
          </div></section>
          <section class="m-doc-details" id="gafc2a7463570f753f22185c1529bd9ee6"><div>
            <h3>
              <span class="m-doc-wrap-bumper">fixed_t&lt;20&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#gafc2a7463570f753f22185c1529bd9ee6" class="m-doc-self">lut_reciprocal</a>(</span><span class="m-doc-wrap">int lut_value) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__math_8h.html">&lt;bn_math.h&gt;</a></div>
            </h3>
            <p>Calculates the reciprocal of a value using a LUT.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">lut_value</td>
                  <td>Value in the range [1..1024].</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Reciprocal of the given value (1 / value).</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga312ac8ea549b0f7666489a2070c92985"><div>
            <h3>
              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__power__of__two_8h.html">&lt;bn_power_of_two.h&gt;</a></div>
              <div class="m-doc-template">
                template&lt;typename Type&gt;
              </div>
              <span class="m-doc-wrap-bumper">bool </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga312ac8ea549b0f7666489a2070c92985" class="m-doc-self">power_of_two</a>(</span><span class="m-doc-wrap">Type value) <span class="m-label m-primary">constexpr</span></span></span>
            </h3>
            <p>Indicates if the given value is a power of two or not.</p>
          </div></section>
          <section class="m-doc-details" id="ga439545803e369aae4f082185a303ad42"><div>
            <h3>
              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__reciprocal__lut_8h.html">&lt;bn_reciprocal_lut.h&gt;</a></div>
              <div class="m-doc-template">
                template&lt;int Precision = 20&gt;
              </div>
              <span class="m-doc-wrap-bumper">fixed_t&lt;Precision&gt; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga439545803e369aae4f082185a303ad42" class="m-doc-self">calculate_reciprocal_lut_value</a>(</span><span class="m-doc-wrap">int lut_value) <span class="m-label m-primary">constexpr</span></span></span>
            </h3>
            <p>Calculates the value to store in a reciprocal LUT for the given value.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Template parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">Precision</td>
                  <td>Number of bits used for the fractional part of the reciprocal value.</td>
                </tr>
              </tbody>
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td>lut_value</td>
                  <td>Value in the range (&gt;= 1).</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Reciprocal of the given value (1 / value).</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
          <section class="m-doc-details" id="ga82b19260c9629813641b3b12d41f6c4c"><div>
            <h3>
              <span class="m-doc-wrap-bumper">int </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga82b19260c9629813641b3b12d41f6c4c" class="m-doc-self">calculate_sin_lut_value</a>(</span><span class="m-doc-wrap">int lut_angle) <span class="m-label m-primary">constexpr</span></span></span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__sin__lut_8h.html">&lt;bn_sin_lut.h&gt;</a></div>
            </h3>
            <p>Calculates the value to store in sin_lut for the given angle.</p>
            <table class="m-table m-fullwidth m-flat">
              <thead>
                <tr><th colspan="2">Parameters</th></tr>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 1%">lut_angle</td>
                  <td>sin_lut angle (360 degrees = 65536).</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <th>Returns</th>
                  <td>Sine value in the range [-4096, 4096].</td>
                </tr>
              </tfoot>
            </table>
          </div></section>
        </section>
        <section>
          <h2>Variable documentation</h2>
          <section class="m-doc-details" id="ga61bcfd89f00ba61921ec65d0d63d2929"><div>
            <h3>
              int <a href="#ga61bcfd89f00ba61921ec65d0d63d2929" class="m-doc-self">reciprocal_lut_size</a> <span class="m-label m-primary">constexpr</span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__reciprocal__lut_8h.html">&lt;bn_reciprocal_lut.h&gt;</a></div>
            </h3>
            <p>Reciprocal 20bit LUT size.</p>
          </div></section>
          <section class="m-doc-details" id="ga21a22d7f03116a7613dd016d4dfdf37f"><div>
            <h3>
              const array&lt;fixed_t&lt;20&gt;, reciprocal_lut_size&gt;&amp; <a href="#ga21a22d7f03116a7613dd016d4dfdf37f" class="m-doc-self">reciprocal_lut</a>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__reciprocal__lut_8h.html">&lt;bn_reciprocal_lut.h&gt;</a></div>
            </h3>
            <p>Reciprocal 20bit LUT.</p>
          </div></section>
          <section class="m-doc-details" id="gaf652abc9f83efb92dfe600eb7a4f41f8"><div>
            <h3>
              int <a href="#gaf652abc9f83efb92dfe600eb7a4f41f8" class="m-doc-self">reciprocal_16_lut_size</a> <span class="m-label m-primary">constexpr</span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__reciprocal__lut_8h.html">&lt;bn_reciprocal_lut.h&gt;</a></div>
            </h3>
            <p>Reciprocal 16bit LUT size.</p>
          </div></section>
          <section class="m-doc-details" id="ga04a69179088d3b9b510a9ca99770cc63"><div>
            <h3>
              const array&lt;uint16_t, reciprocal_16_lut_size&gt;&amp; <a href="#ga04a69179088d3b9b510a9ca99770cc63" class="m-doc-self">reciprocal_16_lut</a>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__reciprocal__lut_8h.html">&lt;bn_reciprocal_lut.h&gt;</a></div>
            </h3>
            <p>Reciprocal 16bit LUT.</p>
          </div></section>
          <section class="m-doc-details" id="ga170826a79a9cb7f906d35193f51ec36a"><div>
            <h3>
              int <a href="#ga170826a79a9cb7f906d35193f51ec36a" class="m-doc-self">sin_lut_size</a> <span class="m-label m-primary">constexpr</span>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__sin__lut_8h.html">&lt;bn_sin_lut.h&gt;</a></div>
            </h3>
            <p>Size of the sine LUT of 16bit values in 4.12 format.</p>
          </div></section>
          <section class="m-doc-details" id="gae40612108ff33cd48ca1b2c25dea2064"><div>
            <h3>
              const array&lt;int16_t, sin_lut_size&gt;&amp; <a href="#gae40612108ff33cd48ca1b2c25dea2064" class="m-doc-self">sin_lut</a>
              <div class="m-doc-include m-code m-inverted m-text-right"><span class="cp">#include</span> <a class="cpf" href="bn__sin__lut_8h.html">&lt;bn_sin_lut.h&gt;</a></div>
            </h3>
            <p>Sine LUT of 16bit values in 4.12 format.</p>
          </div></section>
        </section>
      </div>
    </div>
  </div>
</article></main>
<div class="m-doc-search" id="search">
  <a href="#!" onclick="return hideSearch()"></a>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-m-8 m-push-m-2">
        <div class="m-doc-search-header m-text m-small">
          <div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
          <div id="search-symbolcount">&hellip;</div>
        </div>
        <div class="m-doc-search-content">
          <form>
            <input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
          </form>
          <noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
          <div id="search-help" class="m-text m-dim m-text-center">
            <p class="m-noindent">Search for symbols, directories, files, pages or
            modules. You can omit any prefix from the symbol or file path; adding a
            <code>:</code> or <code>/</code> suffix lists all members of given symbol or
            directory.</p>
            <p class="m-noindent">Use <span class="m-label m-dim">&darr;</span>
            / <span class="m-label m-dim">&uarr;</span> to navigate through the list,
            <span class="m-label m-dim">Enter</span> to go.
            <span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
            copy a link to the result using <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">L</span> while <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">M</span> produces a Markdown link.</p>
          </div>
          <div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
          <ul id="search-results"></ul>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="search-v2.js"></script>
<script src="searchdata-v2.js" async="async"></script>
<footer><nav>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <p>Butano Docs. Created with <a href="https://doxygen.org/">Doxygen</a> 1.14.0 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
      </div>
    </div>
  </div>
</nav></footer>
</body>
</html>
